<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" media="screen" href="../../global/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" media="screen" href="../../global/layui/css/layui.css">
        <link rel="stylesheet" href="../../global/css/ztree/zTreeStyle/zTreeStyle.css" type="text/css">
        <link rel="stylesheet" href="../../global/css/ztree/demo.css" type="text/css">
</head>
<body>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    <form class="form-horizontal" onsubmit="return false" id="form" enctype="multipart/form-data">
        <fieldset>
     <input type="hidden" id="shopsId" name="shopsId"/>
          <div class="form-group">
           <label class="col-md-2 control-label">到期时间:</label>
           <div class="col-md-5">
            <input class="form-control" placeholder="到期时间"  type="text" name="endTime" id="endTime" data-bv-notempty="true" data-bv-notempty-message="到期时间不能为空" />
           </div>
          </div>
          <div class="form-group">
             <label class="col-md-2 control-label">授权导购数量:</label>
                       <div class="col-md-5">
                        <input class="form-control" placeholder="授权导购数量"  type="text" name="invNumber" id="invNumber" data-bv-notempty="true" data-bv-notempty-message="授权导购数量不能为空" />
                       </div>
                      </div>

         <div class="form-group">
                      <label class="col-md-2 control-label">板块权限:</label>
                               <input type="checkbox" name="shopsAttr" value="1" />外卖
                               <input type="checkbox" name="shopsAttr" value="2" />团购
                               <input type="checkbox" name="shopsAttr" value="3" />点餐
                               </div>

                <div class="form-actions">
                <div class="row" align="center">
                    <div class="col-md-12">
                        <button class="btn btn-primary" type="submit" onclick="pass()">审核通过</button>
                    </div>
                </div>
            </div>
        </fieldset>
    </form>
</div>
<script type="text/javascript" src="../../global/js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../global/js/jq.js"></script>
<script type="text/javascript" src="../../global/js/plugin/bootstrapvalidator/bootstrapValidator.min.js"></script>
<script type="text/javascript" src="../../global/js/common.js"></script>
<script type="text/javascript" src="../../global/js/libs/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="../../global/layui/layui.js"></script>
<script type="text/javascript" src="../../global/js/ajaxfileupload.js"></script>
<script type="text/javascript"
	src="https://webapi.amap.com/maps?v=1.4.10&key=5f80e00b3a03bce6ac34804ff562a19f"></script>
<script type="text/javascript"
	src="https://webapi.amap.com/demos/js/liteToolbar.js"></script>
<script src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
<script type="text/javascript">
 layui.use('layer', function () {
        var layer = layui.layer;
    });

    var id = getUrlParam("id");
    $("#shopsId").val(id);


    $('#form').bootstrapValidator();

    function pass() {
           obj = document.getElementsByName("shopsAttr");
            check_val = [];
            for(k in obj){
                if(obj[k].checked)
                    check_val.push(obj[k].value);
            }
        // 表单验证
        var bootstrapValidator = $("#form").data('bootstrapValidator');
        bootstrapValidator.validate();
        if (!bootstrapValidator.isValid()) {
            return;
        }
         $("form").ajaxSubmit({
            type: 'post',
            url: '/clyjNearbyShops/saveShops',
            data:{"typeIds":check_val},
            traditional: true,
            contentType: "application/json; charset=utf-8",
            //data: JSON.stringify(formdata),
            success: function (data) {
                layer.msg("修改成功", {shift: -1, time: 1000}, function () {
                    location.href = "shopsList.html";
                });
            }
        });
    }
</script>
</body>
</html>